/**
 * Copyright(C) 2008 Matthias Braunhofer
 * All rights reserved
 *
 * Created on: 26.07.2008
*/

package it.cums.ui.editors.order;

import it.cums.core.model.Order;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

public class OrderEditorInput implements IEditorInput {
	private final Order order;

	public OrderEditorInput(Order order) {
		this.order = order;
	}

	
	public boolean exists() {
		// TODO Auto-generated method stub
		return false;
	}

	
	public ImageDescriptor getImageDescriptor() {
		// TODO Auto-generated method stub
		return null;
	}

	
	public String getName() {
		return order.toString();
	}

	
	public IPersistableElement getPersistable() {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.IEditorInput#getToolTipText()
	 */
	
	public String getToolTipText() {
		return order.toString();
	}

	@SuppressWarnings("unchecked")
	
	public Object getAdapter(Class adapter) {
		// TODO Auto-generated method stub
		return null;
	}
	
	public Order getOrder() {
		return order;
	}

	
	public boolean equals(Object obj) {
		if (super.equals(obj)) {
			return true;
		}
		if (obj instanceof OrderEditorInput) {
			return order.getId() == ((OrderEditorInput) obj).getOrder().getId();
		}
		return false;
	}

	
	public int hashCode() {
		return order.getId();
	}

}

